package com.vans.api.feign.fallback;

import com.vans.api.feign.order.OrderServiceFeign;
import feign.hystrix.FallbackFactory;
import order.OrderInfoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class MyFallBackFactory implements FallbackFactory<OrderServiceFeign>  {

    public interface OrderServiceFeignWithFactory extends OrderServiceFeign {
    }

    private static final Logger log = LoggerFactory.getLogger(MyFallBackFactory.class);
    @Override
    public OrderServiceFeign create(Throwable throwable) {
        log.info(throwable.getMessage());
        return (MyFallBackFactory.OrderServiceFeignWithFactory) userId -> new OrderInfoVO(0,0);
    }

}
